Skip to content

Z-Wave Lock: Treat a masked Schlage code report as confirmation of a pending set - #3366

Closed
kainpets wants to merge 1 commit into
SmartThingsCommunity:mainfrom
kainpets:zwave-lock/schlage-masked-set-confirmation
Closed

kainpets wants to merge 1 commit into
SmartThingsCommunity:mainfrom
kainpets:zwave-lock/schlage-masked-set-confirmation

Conversation

@kainpets

Copy link
Copy Markdown
Contributor

Check all that apply

Type of Change

  • WWST Certification Request
    • If this is your first time contributing code:
      • I have reviewed the README.md file
      • I have reviewed the CODE_OF_CONDUCT.md file
      • I have signed the CLA
    • I plan on entering a WWST Certification Request or have entered a request through the WWST Certification console at developer.smartthings.com
  • Bug fix
  • New feature
  • Refactor

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have verified my changes by testing with a device or have communicated a plan for testing
  • I am adding new behavior, such as adding a sub-driver, and have added and run new unit tests to cover the new behavior

Description of Change

Fixes #3365.

Schlage locks confirm a UserCode:Set with an occupied UserCode Report whose code is masked (**********) or blank. On migrated locks, schlage-lock/init.lua classified that report as manufacturer-specific (is_user_code_report_mfr_specific) and dropped it. As a result, addCredential and updateCredential never emitted a commandResult, the credential was never recorded, and because tables.next_index kept returning the same slot, the next addCredential overwrote the PIN.

While an add or update is waiting on a slot, an occupied report for that slot now goes to the generic user_code_report handler, which already handles a report with the code in clear. Every other masked report is still consumed as before, including the index 0 master-code case.

This is the success-side counterpart of #3318 (masked reports during code sync) and #3364 (refused PINs). It touches the same function as #3364, so whichever merges second needs a small rebase.

Summary of Completed Tests

New tests in test_schlage_lock.lua:

  • addCredential: a masked occupied report for the new slot confirms the add, and the next add goes to slot 2.
  • addCredential: a masked occupied report for another slot does not confirm the add.
  • updateCredential: a masked occupied report for the slot confirms the update.

Without the change, the first and third fail. With it, test_schlage_lock.lua and test_schlage_lock_legacy.lua pass (12/12). The full zwave-lock run locally has the same 17 failures as unmodified main (test_lock_programming_code, test_lock_code_slga_migration, test_zwave_responses), which I believe come from running against the latest public lua_libs (API v21) rather than this change.

Device testing plan: we'll install this build on a migrated Schlage BE469 in our lab and confirm addCredential reports success and a second add lands in a new slot.

🤖 Generated with Claude Code

…pending set

Schlage locks confirm a UserCode Set with an occupied report whose code is
masked ("**********") or blank. On migrated locks the Schlage sub-driver
classified that report as manufacturer-specific and dropped it, so
addCredential and updateCredential never emitted a commandResult, the
credential was never recorded, and the next addCredential reused the same
slot and overwrote the PIN.

While an add or update is waiting on a slot, an occupied report for that
slot now goes to the generic handler, as a report with the code in clear
already does. Other masked reports are still consumed as before.

Fixes SmartThingsCommunity#3365

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@kainpets

Copy link
Copy Markdown
Contributor Author

Superseded by #3373.

@kainpets kainpets closed this Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zwave-lock: Schlage sub-driver drops the UserCode Report that confirms addCredential (no commandResult, slot reused)

2 participants